<body class="wy-body">
<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-form layui-card-header wy-card-header-auto">
			<div class="layui-form-item">
			<form action="{:url(request()->action())}" method="get">
				<div class="layui-inline">
					<label class="layui-form-label wy-width-auto">广告ID</label>
					<div class="layui-input-inline">
						<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input" value="{$get_data.id}">
					</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label wy-width-auto">广告名称</label>
					<div class="layui-input-inline">
						<input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input" value="{$get_data.title}">
					</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label wy-width-auto">广告位</label>
					<div class="layui-input-inline">
						<select name="cat_id">
							<option value="">--请选择--</option>
							{volist name="poster_lists" id="vo"}
							<option value="{$vo.id}" {if $get_data.cat_id == $vo.id} selected {/if}>{$vo.name}</option>
							{/volist}
						</select>
					</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label layui-width-auto">发布时间</label>
					<div class="layui-input-inline wy-width-auto">
						<input type="text" name="push" class="layui-input wy-datetime-range" placeholder=" ~ " value="{$get_data.push}">
					</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label wy-width-auto">状态</label>
					<div class="layui-input-inline">
						<select name="status">
							<option value="">--请选择--</option>
							<option value="1" {if $get_data.status == 1} selected {/if}>展示中</option>
							<option value="2" {if $get_data.status == 2} selected {/if}>未开始</option>
							<option value="3" {if $get_data.status == 3} selected {/if}>已结束</option>
							<option value="4" {if $get_data.status == 4} selected {/if}>已关闭</option>
						</select>
					</div>
				</div>
				<div class="layui-inline">
					<button class="layui-btn">
						<i class="layui-icon layui-icon-search"></i>
					</button>
				</div>
			</form>
			</div>
		</div>

		<div class="layui-card-body">
			<div style="padding-bottom: 10px;">
				<button class="layui-btn wy_but"
					wy-event="lay_ajax_post"
					wy-url="{:url('del')}"
					wy-tips="确认是否删除该信息，删除以后将无法恢复"
					wy-table="wy_table_lists"
					wy-field="id"
				>删除</button>
				<button class="layui-btn wy_but"
					wy-event="lay_parent_tab"
					wy-url="{:url('add')}"
					wy-id="bannerimages_info"
					wy-title="添加广告"
				>添加</button>
			</div>

<table class="layui-table" name="wy_table_lists" lay-filter="wy_table_lists"
	lay-data="{
		height:'full-166',
		cellMinWidth:'180',
		url:'{:url('ajax_lists')}',
		where: {
			{$get_str}
		},
		method:'post',
		page:true,
		id:'wy_table_lists',
		limit:15,
		limits:[15,30,50,100]}"
>
<thead>
<thead>
<tr>
	<th lay-data="{type: 'checkbox', fixed: 'left'}">选择</th>
	<th lay-data="{width:'70',field:'id'}">ID</th>
	<th lay-data="{width:'100',field:'title'}">标题</th>
	<th lay-data="{width:'120',field:'cat_name'}">广告位</th>
	<th lay-data="{width:'180',templet:'#show_img'}">广告图</th>
	<th lay-data="{width:'170',field:'start_date'}">开始时间</th>
	<th lay-data="{width:'170',field:'end_date'}">结束时间</th>
	<th lay-data="{width:'80',field:'onclick_num'}">访问量</th>
	<th lay-data="{width:'65',field:'sort'}">排序</th>
	<th lay-data="{width:'120',templet:'#statusTool'}">状态</th>
	<th lay-data="{width:'170',field:'create_date'}">发布时间</th>
	<th lay-data="{toolbar:'#barTool'}">操作</th>
</tr>
</thead>
</table>

<script type="text/html" id="show_img">
{{# if(d.img){ }}
	<img src="{{d.img}}" class="table-img">
{{# }else{ }}
	暂无图片
{{# } }}
</script>
<script type="text/html" id="statusTool">
{{#
	var timestamp = (new Date()).getTime();
	timestamp = timestamp/1000;
}}

{{# if(d.status == 1){ }}
	{{# if(d.start_time == 0 && d.end_time == 0){ }}
		<span class="layui-btn layui-btn-xs layui-btn-danger">展示中</span>
	{{# }else if(d.start_time == 0 && d.end_time > timestamp){ }}
		<span class="layui-btn layui-btn-xs layui-btn-danger">展示中</span>
	{{# }else if(d.end_time == 0 && d.start_time < timestamp){ }}
		<span class="layui-btn layui-btn-xs layui-btn-danger">展示中</span>
	{{# }else{ }}
		{{# if(d.start_time < timestamp && d.end_time > timestamp){ }}
			<span class="layui-btn layui-btn-xs layui-btn-danger">展示中</span>
		{{# }else if(d.start_time >= timestamp){ }}
			<span class="layui-btn layui-btn-xs layui-btn-warm">未开始</span>
		{{# }else if(d.end_time <= timestamp){ }}
			<span class="layui-btn layui-btn-xs ">已结束</span>
		{{# } }}
	{{# } }}
{{# }else{ }}
	<span class="layui-btn layui-btn-xs layui-btn-disabled">已关闭</span>
{{# } }}
</script>
<script type="text/html" id="barTool">
<div class="layui-btn-group">
	<a class="layui-btn layui-btn-xs layui-btn-primary wy_but"
		wy-event="lay_parent_tab"
		wy-url="{:url('edit')}?id={{d.id}}"
		wy-id="bannerimages_info"
		wy-title="编辑广告"
	>编辑</a>

	<a class="layui-btn layui-btn-xs layui-btn-primary wy_but" 
		wy-event="lay_ajax_get"
		wy-url="{:url('del')}?id={{d.id}}"
		wy-tips="确认是否删除该信息，删除以后将无法恢复"
		wy-table="wy_table_lists"
	>删除</a>
</div>
</script>
		</div>
	</div>
</div>
<style>
.wy-btn-select{
	width:auto;
}
</style>
</body>